package edu.jiefengli.course_selection_system.service.impl;

import edu.jiefengli.course_selection_system.mapper.UserMapper;
import edu.jiefengli.course_selection_system.pojo.entity.User;
import edu.jiefengli.course_selection_system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    public User login(User user) {
        return userMapper.getUserByAccount(user.getAccount());
    }

    public List<User> getAllUsers() {
        return userMapper.getAllUsers();
    }


    public void addUser(User user) {
        userMapper.addUser(user);
    }

    @Override
    public User getUserById(int id) {
        return userMapper.getUserById(id);
    }
}
